package com.wlyuan.open.domain.client.respository;

import com.wlyuan.open.domain.client.OpenClientId;
import com.wlyuan.open.vo.OpenApiCompanyDetailVO;
import com.wlyuan.redisson.repository.BaseCacheRepository;
import com.wlyuan.redisson.repository.CacheOptions;
import org.redisson.api.RedissonClient;
import org.redisson.codec.JsonJacksonCodec;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yuanjie
 */
@Service
public class OpenClientApiCacheRepository extends BaseCacheRepository<OpenClientId, List<OpenApiCompanyDetailVO>> {
    public OpenClientApiCacheRepository(RedissonClient redissonClient, JsonJacksonCodec jsonJacksonCodec,
                                        OpenClientApiCacheResolver cacheResolver) {
        super(new CacheOptions("PC::CACHE::OPEN::CLIENT::API", 24 * 60L, 1000),
                redissonClient, jsonJacksonCodec, cacheResolver);
    }

    @Override
    public void remove(OpenClientId clientId) {
        if (clientId != null) {
            super.remove(clientId);
        }
    }
}
